package com.net.xpay.common.domain.stat;

import com.net.common.domain.CommonDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 合伙人实时统计表
 */
@Setter
@Getter
@NoArgsConstructor
public class PartnerRealTimeStat extends CommonDomain {

    @ApiModelProperty(notes = "合伙人id")
    private Long partnerId;

    @ApiModelProperty(notes = "服务费充值金额 单位元 保留2小数")
    private BigDecimal serviceChargeFee;

    @ApiModelProperty(notes = "总转账笔数")
    private Long totalCount;

    @ApiModelProperty(notes = "批量有密转账笔数")
    private Long payTransCount;

    @ApiModelProperty(notes = "安全发转账笔数")
    private Long safePayTransCount;

    @ApiModelProperty(notes = "总转账成功笔数")
    private Long totalSuccessCount;

    @ApiModelProperty(notes = "批量有密转账成功笔数")
    private Long payTransSuccessCount;

    @ApiModelProperty(notes = "安全发成功转账笔数")
    private Long safePayTransSuccessCount;

    @ApiModelProperty(notes = "总转账失败笔数")
    private Long totalFailCount;

    @ApiModelProperty(notes = "批量有密转账失败笔数")
    private Long payTransFailCount;

    @ApiModelProperty(notes = "安全发失败转账笔数")
    private Long safePayTransFailCount;

    @ApiModelProperty(notes = "总服务费支出 单位元 保留2小数")
    private BigDecimal totalServicePrice;

    @ApiModelProperty(notes = "批量有密服务费支出 单位元 保留2小数")
    private BigDecimal payTransServicePrice;

    @ApiModelProperty(notes = "安全发服务费支出 单位元 保留2小数")
    private BigDecimal safePayTransServicePrice;

    @ApiModelProperty(notes = "总转账金额 单位元 保留2小数")
    private BigDecimal totalTransAmount;

    @ApiModelProperty(notes = "批量有密转账金额 单位元 保留2小数")
    private BigDecimal payTransAmount;

    @ApiModelProperty(notes = "安全发转账金额 单位元 保留2小数")
    private BigDecimal safePayTransAmount;

    @ApiModelProperty(notes = "总转账成功金额 单位元 保留2小数")
    private BigDecimal totalSuccessTransAmount;

    @ApiModelProperty(notes = "批量有密转账成功金额 单位元 保留2小数")
    private BigDecimal payTransSuccessAmount;

    @ApiModelProperty(notes = "安全发转账成功金额 单位元 保留2小数")
    private BigDecimal safePayTransSuccessAmount;

    @ApiModelProperty(notes = "总转账失败金额 单位元 保留2小数")
    private BigDecimal totalFailTransAmount;

    @ApiModelProperty(notes = "批量有密转账失败金额 单位元 保留2小数")
    private BigDecimal payTransFailAmount;

    @ApiModelProperty(notes = "安全发转账失败金额 单位元 保留2小数")
    private BigDecimal safePayTransFailAmount;

    @ApiModelProperty(notes = "一级合伙人总收益 单位元 保留2小数")
    private BigDecimal totalPartnerBenefit;

    @ApiModelProperty(notes = "一级合伙人总收益(批量有密) 单位元 保留2小数")
    private BigDecimal totalPayTransPartnerBenefit;

    @ApiModelProperty(notes = "一级合伙人总收益(安全发) 单位元 保留2小数")
    private BigDecimal totalSafePayTransPartnerBenefit;

    @ApiModelProperty(notes = "新入驻商户数")
    private Long registerCount;

    @ApiModelProperty(notes = "更新时间")
    private LocalDateTime updateTime;


    public static PartnerRealTimeStat getInstance(Long partnerId, LocalDateTime time) {
        PartnerRealTimeStat stat = new PartnerRealTimeStat();

        stat.setPartnerId(partnerId);
        stat.setServiceChargeFee(new BigDecimal("0.00"));
        stat.setTotalCount(0L);
        stat.setPayTransCount(0L);
        stat.setSafePayTransCount(0L);
        stat.setTotalSuccessCount(0L);
        stat.setPayTransSuccessCount(0L);
        stat.setSafePayTransSuccessCount(0L);
        stat.setTotalFailCount(0L);
        stat.setPayTransFailCount(0L);
        stat.setSafePayTransFailCount(0L);
        stat.setTotalServicePrice(new BigDecimal("0.00"));
        stat.setPayTransServicePrice(new BigDecimal("0.00"));
        stat.setSafePayTransServicePrice(new BigDecimal("0.00"));
        stat.setTotalTransAmount(new BigDecimal("0.00"));
        stat.setPayTransAmount(new BigDecimal("0.00"));
        stat.setSafePayTransAmount(new BigDecimal("0.00"));
        stat.setTotalSuccessTransAmount(new BigDecimal("0.00"));
        stat.setPayTransSuccessAmount(new BigDecimal("0.00"));
        stat.setSafePayTransSuccessAmount(new BigDecimal("0.00"));
        stat.setTotalFailTransAmount(new BigDecimal("0.00"));
        stat.setPayTransFailAmount(new BigDecimal("0.00"));
        stat.setSafePayTransFailAmount(new BigDecimal("0.00"));
        stat.setTotalPartnerBenefit(new BigDecimal("0.00"));
        stat.setTotalPayTransPartnerBenefit(new BigDecimal("0.00"));
        stat.setTotalSafePayTransPartnerBenefit(new BigDecimal("0.00"));
        stat.setRegisterCount(0L);
        stat.setUpdateTime(time);
        return stat;
    }
}
